import http from '@/utils/request'

const apiBefore = '/web/um'

export const login = {
  webLoginApi: data => {
    return http.post(`${apiBefore}/login`, data)
  },
  webRegistApi: data => {
    return http.post(`${apiBefore}/sys/tenant/reg-email`, data)
  },
  office365LoginApi: data => {
    return http.post(`${apiBefore}/teams-login`, data)
  },
  loginUserInfoApi: params => {
    return http.get(`${apiBefore}/sys/user/info`, params)
  },
  sendEmail: params => {
    return http.get(`${apiBefore}/sys/user/forgetPassword`, { params })
  },
  registTenant: params => {
    return http.post(`${apiBefore}/sys/tenant/reg`, params)
  },
  loginAfterSyncUserDataApi: params => {
    return http.get(`${apiBefore}/teams-user/login-sync`, { params })
  },
  isRegistered: params => {
    return http.get(`${apiBefore}/sys/tenant/exist/microsoftId`, { params })
  },
  postFeedBack: params => {
    return http.post(`${apiBefore}/tenant/feedback`, params)
  },
  toggleTenant: params => {
    return http.get(`${apiBefore}/sys/menu/allowed/${params.tenantCode}`, { params })
  },
  // New Login By Account
  checkRepeatNameApi: params => {
    return http.post(`${apiBefore}/sys/tenant/reg-checkname`, params)
  },
  exportDashboardPdf: params => {
    return http.post(`pdf/api/render`, params, {
      responseType: 'arraybuffer'
    })
  }
}
